﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.ComponentModel;


namespace baseClass.Controls
{
    public class gridItem : common.controls.baseDataGridView 
    {
        public enum ColumnNames
        {
            itemCode,name,unit
        };

        public gridItem()
        {
        }

        public override void LockEdit(bool lockStat)
        {
            base.LockEdit(true); 
        }
        public override void Init()
        {
            base.Init();
            data.baseDS.geItemDataTable dummyTbl = new data.baseDS.geItemDataTable();

            // =============================
            // detailGrid
            // =============================

            // itemCode
            common.controls.DataGridViewTextBoxColumnExt itemCode = new common.controls.DataGridViewTextBoxColumnExt();
            itemCode.Uppercase = true;
            itemCode.DataPropertyName = dummyTbl.codeColumn.ColumnName;
            itemCode.HeaderText = "Mã số";
            itemCode.Name = ColumnNames.itemCode.ToString();
            itemCode.Width = 130;

            // notes
            common.controls.DataGridViewTextBoxColumnExt name = new common.controls.DataGridViewTextBoxColumnExt();
            name.DataPropertyName = dummyTbl.nameColumn.ColumnName;
            name.HeaderText = "Diễn giải";
            name.Name = ColumnNames.name.ToString();
            name.Width = 130;

            // unit
            common.controls.DataGridViewTextBoxColumnExt unit = new common.controls.DataGridViewTextBoxColumnExt();
            unit.DataPropertyName = dummyTbl.unitColumn.ColumnName;
            unit.HeaderText = "ĐVT";
            unit.Name = ColumnNames.name.ToString();
            unit.Width = 70;

            this.Columns.Clear();
            this.Columns.AddRange(new DataGridViewColumn[] { itemCode, name,unit});

            this.myAutoFitColumn = ColumnNames.name.ToString();
            this.AutoFit();
        }

    }
}
